package com.inphase.myfood.testspring;

import java.util.Iterator;
import java.util.List;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.inphase.myfood.model.Dash;
import com.inphase.myfood.model.Food;
import com.inphase.myfood.model.Foodcategory;
import com.inphase.myfood.model.Member;
import com.inphase.myfood.model.Picture;
import com.inphase.myfood.service.DashService;
import com.inphase.myfood.service.FoodCategoryService;
import com.inphase.myfood.service.FoodService;
import com.inphase.myfood.service.MemberService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:/applicationContext.xml" })
public class SpringTest02 {
	@Resource(name = "memberService")
	private MemberService memberService;
	@Resource(name = "dashService")
	private DashService dashService;
	@Resource(name = "foodService")
	private FoodService foodService;
	@Resource(name = "foodCategoryService")
	private FoodCategoryService foodCategoryService;

	/**
	 * 测试FoodCategory
	 */
	@Test
	public void testFoodCategory() {
		Foodcategory foodcategory = foodCategoryService.getObjectByPK(new Long(
				100));
		for (Iterator<Food> iterator = foodcategory.getFoods()
				.iterator(); iterator.hasNext();) {
			Food food = iterator.next();
			System.out.println(food.getFoodName());
		}
	}
}
